package com.tbit.main.dao.core;

import com.tbit.main.pojo.VO.WorkOrderFinishingQueryReqVO;
import com.tbit.main.pojo.WorkOrder;
import com.tbit.main.pojo.WorkOrderFinishing;
import com.tbit.main.pojo.WorkOrderSta;
import com.tbit.main.pojo.WorkOrderTypeSta;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author LMY
 * @create 2021-05-18 15:40
 * 工单
 */
public interface WorkOrderFinishingDao {
    /**
     * 创建工单
     *
     * @param workOrder
     */
    void insert(WorkOrder workOrder);

    /**
     * 根据运营区域查询
     *
     * @return
     */
    List<WorkOrderFinishing> getByAccountId(Integer accountId);

    /**
     * 根据运营区域查询
     *
     * @param map
     * @return
     */
    List<WorkOrderFinishing> getByAccountIdAndWorkType(Map<String, Object> map);

    /**
     * 删除
     *
     * @param workOrderId
     */
    void del(String workOrderId);

    /**
     * 修改工单状态
     *
     * @param map
     */
    void updateState(Map<String, Object> map);

    /**
     * 根据工单编号查询
     *
     * @param workOrderId
     * @return
     */
    WorkOrderFinishing getByWorkOrderId(String workOrderId);

    /**
     * 按时间分组统计
     *
     * @param params
     * @return
     */
    List<WorkOrderSta> groupByTime(Map<String, Object> params);

    /**
     * 根据运营区域和时间查询工单
     *
     * @param map
     * @return
     */
    List<WorkOrderFinishing> getByAccountIdUserId(Map<String, Object> map);

    /**
     * 查询未完成工单总数
     *
     * @param map
     * @return
     */
    Integer getByUserIdCount(Map<String, Object> map);

    /**
     * 未完成的工单详情
     *
     * @param map
     * @return
     */
    List<WorkOrderFinishing> getByUserId(Map<String, Object> map);

    /**
     * 根据车辆编号和类型查询和区域
     *
     * @param map
     * @return
     */
    WorkOrderFinishing getByMachineIdWorkType(Map<String, Object> map);

    /**
     * 根据车辆编号和类型查询
     *
     * @return
     */
    List<WorkOrderFinishing> getByMachineId(Integer machineId);

    /**
     * 批量删除
     *
     * @param workOrderIds
     */
    void delWorkOrderIds(String workOrderIds);

    /**
     * 查询失效
     *
     * @param buildTime
     * @return
     */
    List<WorkOrderFinishing> getByBuildTime(String buildTime);

    /**
     * 查询超时的
     *
     * @param getTime
     * @return
     */
    List<String> getByGetTime(String getTime);

    /**
     * 根据工单类型查询设备id
     *
     * @param workType
     * @return
     */
    List<Integer> getByWorkType(Integer workType);

    /**
     * 未完成工单分组
     *
     * @param map
     * @return
     */
    List<WorkOrderTypeSta> getGroupByType(Map<String, Object> map);

    /**
     * 更新
     *
     * @param workOrder
     */
    void update(WorkOrder workOrder);

    /**
     * 批量删除
     *
     * @param workOrderIds
     */
    void delBatch(@Param("workOrderIds") String workOrderIds);

    /**
     * 获取所有
     *
     * @return
     */
    List<WorkOrderFinishing> getAll();

    /**
     * 根据车辆类型，车辆，状态查询
     *
     * @param map
     * @return
     */
    WorkOrderFinishing getByWorkMachineIdState(Map<String, Object> map);

    /**
     * 根据用户id和工单类型查询
     *
     * @param map
     * @return
     */
    Integer getUserIdWorkType(Map<String, Object> map);

    /**
     * 获取待办工单列表
     * @param reqVO 待办工单查询 ReqVO
     * @return 待办工单列表
     */
    List<WorkOrderFinishing> selectWorkOrderFinishingList(@Param("reqVO") WorkOrderFinishingQueryReqVO reqVO);

    /**
     * 根据车辆类型，车辆，状态查询
     *
     * @param machineId
     * @param state
     * @return
     */
    List<WorkOrderFinishing> selectByWorkMachineIdState(@Param("machineId") Integer machineId, @Param("state") Integer state);
}
